﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace STX.Domain.Report
{
    public class PayInfoDetail
    {
        private BizActivity Activity { get;  set; }
        private BizSupplier Supplier { get; set; }

        public PayInfoDetail(BizActivity activity, BizSupplier supplier)
        {
            Activity = activity;
            Supplier = supplier;
        }

        public string Date
        {
            get
            {
                return string.Format("{0}至{1} {2}", Activity.StartTime.ToString("yyyy-M-d"),
                    Activity.EndTime.ToString("yyyy-M-d"), Activity.TimeDetail);
            }
        }

        public string Name
        {
            get
            {
                return Activity.Name;
            }
        }

        public string ResponsiblePerson
        {
            get
            {
                return Activity.ResponsiblePerson;
            }
        }

        public decimal TotalQuotation
        {
            get
            {
                return Activity.TotalQuotation;
            }
        }

        public decimal IncreaseOrDecrease
        {
            get
            {
                return Activity.IncreaseOrDecrease;
            }
        }

        public decimal ReceiveAmount
        {
            get
            {
                return TotalQuotation + IncreaseOrDecrease;
            }
        }

        public decimal Tax
        {
            get
            {
                return TotalQuotation * (decimal)0.13;
            }
        }

        public string SupplierName
        {
            get
            {
                return Supplier.Name;
            }
        }

        public decimal FinalPay
        {
            get; set;
        }

        public DateTime PayTime
        {
            get;
            set;
        }

        public decimal FinanceCost
        {
            get
            {
                return Activity.BizActivityItems.Where(o => o.SupplierId == Supplier.Id).Sum(o => o.FinanceCostPrice*o.Numb);
            }
        }
    }
}
